// MessageBoxWithTextArea.cs
//

using System;
using System.Collections.Generic;
using jQueryApi;
using System.Html;

namespace TuringMachine
{
   public delegate void DialogEventHandler(MessageBoxBase dlg, bool bOkPressed);

   public class MessageBoxWithTextArea: MessageBoxBase
   {
      jQueryObject m_label = null;
      jQueryObject m_textArea = null;

      public MessageBoxWithTextArea(jQueryObject parent):
         base(parent)
      {
         string id=m_msgBox.GetAttribute("id");
         m_msgBox.Append("<span id=\"" + id + "msg\"></span><br />");
         m_label = m_msgBox.Children("#" + id + "msg");
         m_msgBox.Append("<textarea id=\"" + id + "txt\" rows=\"20\" cols=\"80\"></textarea>");
         m_textArea = m_msgBox.Children("#" + id + "txt");
      }

      public string pLabelText
      {
         get { return m_label.GetText(); }
         set { m_label.Text(value); }
      }

      public string pEditText
      {
         get { return m_textArea.GetValue(); }
         set { m_textArea.Value(value); }
      }

      protected override void PlaceElements()
      {
         m_msgBox.CSS("height", (m_textArea.GetHeight() + 200) + "px");        
      }

      public override void OnShown()
      {
         m_textArea.Focus();
      }
   }
}
